package org.example.demo;


import java.io.FileReader;

/**
 * @ClassName Demo6
 * @Description
 * @Author zhangsw
 * @Date 2020/11/9 16:28
 * @Version 1.0
 */
public class Demo6 {
    public static void main(String[] args) throws Exception {
        /*字符流 GBK编码一个中文占用两个字节，UTF-8一个中文占用三个字节*/
        /*字节输入流 输入到内存中*/
        FileReader reader = new FileReader("aaa.txt");
        char[] zf = new char[1024];//存储读取到的多个字符
        int len = 0;//记录每个读取有效字符个数
        while ((len = reader.read(zf)) != -1) {
            System.out.println(new String(zf, 0, len));
        }
        reader.close();
    }
}
